package com.cheems.cheems_spring_ai.controller;


import com.cheems.cheems_spring_ai.common.BaseResponse;
import com.cheems.cheems_spring_ai.common.ResultUtils;
import com.cheems.cheems_spring_ai.domain.dto.UserDTO;
import com.cheems.cheems_spring_ai.domain.vo.UserVo;
import com.cheems.cheems_spring_ai.service.UserService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 河南农大统一授权登录
     * @param userDTO
     * @return
     */
    @PostMapping("/login")
    public BaseResponse<UserVo> login(@RequestBody UserDTO userDTO) {
        String code = userDTO.getCode();
        UserVo userVo = userService.login(code);
        return ResultUtils.success(userVo);
    }
}
